//
import { http } from '@/utils/http'
interface ResponsePage {
  code: number
  data: Home
  page: number
  pageSize: number
  totalCount: number
  totalPage: number
}
interface Home {
  ad: Ad
  flashSale: FlashSale[]
}
interface Ad {
  banner: CurrentType[]
  nav: CurrentType[]
  ad: CurrentType[]
}
interface CurrentType {
  type: number
  title: string // 标题
  pic: string // 图片
  link: string // 链接
  link_type: string // 跳转方式
}
interface FlashSale {
  id: number
  title: string // 活动标题
  desp: string
  pic: string | null
  bonus: number | null
  status: number | null // 活动状态
  type: number | null // 活动类型:1=秒杀
  params: string | null // 活动参数 商品ID，价格，库存
  start_time: string // 开始时间
  end_time: string // 结束时间
  create_time: string // 创建时间
}
/** 获取首页数据 */
export const getHomePage = () => {
  return http.post<ResponsePage>('home', {})
}
export interface RecommendPage {
  code: number
  data: Recommend
  page: number
  pageSize: number
  totalCount: number
  totalPage: number
}
export interface Recommend {
  id: number
  name: string
  desc: string
  price: string
  pic: string
  storage: number
  buy_count: number
}
export const getRecommend = () => {
  return http.post<RecommendPage>('recommend', {})
}
